import { OrganizationService } from 'src/app/services/organization.service';
import { Component, Input, OnInit } from '@angular/core';
import { ExceptionHandler } from 'src/app/handler/exception.handler';

@Component({
  selector: 'zepride-org-base-info',
  templateUrl: './org-base-info.component.html',
  styleUrls: ['./org-base-info.component.less']
})
export class OrgBaseInfoComponent implements OnInit {
  @Input() organizationInfo;
  isOrgBaseEdit;
  constructor(
    private orgSvr: OrganizationService
  ) { }

  ngOnInit(): void {

  }

  async saveOrgInfo() {
    try {
      const data = await this.orgSvr.updateOrganization(this.organizationInfo);
      this.isOrgBaseEdit = false;
    } catch (error) {
      ExceptionHandler.current.handleError(error);
    } finally {

    }
  }

  editOrgBaseInfo() {
    this.isOrgBaseEdit = true;
  }

  async cancelEditOrgInfo() {
    this.isOrgBaseEdit = false;
  }

}
